{% extends 'base.html' %} {% from 'bootstrap/form.html' import render_form %} {%
block title %}BabyLog 管理页 {% endblock %} {% block content %}

<div class="jumbotron">
  <!-- 管理权限>=5才会显示 -->
  {% if current_user.is_authenticated %} {% if current_user.gm >= 5 %}
  <a href="{{ url_for('addUser') }}" target="_blank" rel="noopener noreferrer"
    >添加用户（用来记录日志的父母亲属）</a>
  | <a href="#" rel="noopener noreferrer">添加baby</a>
  <hr />
<h3>用户资料管理</h3>
  <table class="table table-bordered">
    <thead>
      <tr>
        <th scope="col">用户</th>
        <th scope="col">家庭关系</th>
        <th scope="col">管理权限</th>
        <th scope="col">操作选项</th>
      </tr>
    </thead>
    <tbody>
        {% for user in users %}
        <tr>
            <th scope="col">{{ user.username  }}</th>
            <th scope="col">{{ user.familymembers }}</th>
            <th scope="col">{{ user.gm }}</th>
            <th scope="col">  <a href="{{ url_for('editUser',id = user.id ) }}" target="_blank" rel="noopener noreferrer">修改资料</a></th>
          </tr>
        {% endfor %}
    </tbody>
  </table>

  <h3>baby资料管理</h3>
  <table class="table table-bordered">
    <thead>
      <tr>
        <th scope="col">baby</th>
        <th scope="col">生日</th>
        <th scope="col">操作选项</th>
      </tr>
    </thead>
    <tbody>
        {% for baby in babys %}
        <tr>
            <th scope="col">{{ baby.name  }}</th>
            <th scope="col">{{ baby.birthday }}</th>
            <th scope="col">  <a href="{{ url_for('editBaby',id = baby.id ) }}" target="_blank" rel="noopener noreferrer">修改资料</a></th>
          </tr>
        {% endfor %}
    </tbody>
  </table>

  <h3>baby身高体重管理</h3>
  <table class="table table-bordered">
    <thead>
      <tr>
        <th scope="col">身高</th>
        <th scope="col">体重</th>
        <th scope="col">创建日期</th>
        <th scope="col">操作选项</th>
      </tr>
    </thead>
    <tbody>
        {% for healthy in healthys %}
        <tr>
            <th scope="col">{{ healthy.height  }}</th>
            <th scope="col">{{ healthy.weight }}</th>
            <th scope="col">{{ healthy.create_time }}</th>
            <th scope="col">  <a href="{{ url_for('editHealthy',id = healthy.id ) }}" target="_blank" rel="noopener noreferrer">修改数据</a></th>
          </tr>
        {% endfor %}
    </tbody>
  </table>
  {% endif %} {% endif %}
</div>
{% endblock %}
